package com.example.administrator.base.util;

import android.content.Context;
import android.content.Intent;
import android.location.LocationManager;
import android.provider.Settings;

import com.example.administrator.base.bean.CityBunds;
import com.example.administrator.base.bean.CityList;

/**
 * Created by Administrator on 2017/10/27 0027.
 */

public class NoToName {
    /**
     * 将城市代码转换成城市名称
     *
     * @param context 全局信息接口
     * @param context 城市代码
     * @return 城市名称
     */
    public static String numberToName( Context context,int cityNo) {
        String  cityname="";
        String city= String.valueOf(SharedPreferencesUtils.getParam(context,"cityname",""));
        if (city.equals("")){
            return cityname;
        }
        if (cityNo==0){
            return "未绑定城市";
        }
        CityList cityList=GsonTools.changeGsonToBean(city,CityList.class);
        int size = cityList.getDeliverCity().size();
        for (int i=0;i<size;i++){
            int number=cityList.getDeliverCity().get(i).getCityAreaId();
            if (cityNo==number){
                cityname=cityList.getDeliverCity().get(i).getCityName();
                break;
            }
        }
        return cityname ;
    }



}